#
# $Id: Makefile 3479 2012-04-23 13:30:24Z mortens $
#
# (C) Copyright 2012, met.no 
#
# This file is part of the ProRad software system for processing
# radar data
#
# The ProRad software is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2.1,
# or (at your option) any later version.
#
# ProRad is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with ProRad; see the file COPYING. If not, write to the Free
# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
#
#


#/*! \file Makefile
#  \brief Makefile for the nearest to ground library
#
#  \date Q1 2009
#
#
#*/

GCC= gcc -Wall -static -DMESSAGE_DEBUG

CXX= gcc -Wall -fopenmp
CC=  gcc -Wall -fopenmp

ARFLAGS := -r

CPPFLAGS =

LIBS     := -L. -L../lib

INCL     := -I. -I../include -I/usr/include/libxml2 $(shell gdal-config --cflags)

LDFLAGS  := -lstdc++ -lnearest2ground -lproradmsg -lxml2 -lheight-file -lprorad_xmlprod_rw -lprorad_radarprod_meta -lbase64 -lgd -lxmlsupport -lproj -ltiff -lboost_filesystem -lmapfuncs -lproradproj -lboost_regex -L/usr/lib/ogdi $(shell gdal-config --libs) -lmd5sum

THELIB   := libnearest2ground.a
SRCS     := 
OBJS     := check-product.o\
	make-radar-selection.o\
	Radar-config.o\
	Radars-config.o\
	radar-topo.o\
	write-xml-file.o\
	calc-height-above-ground.o\
	calc-blocking-map.o\
	calc-block-map-circle.o\
	reproject-height.o\
	init-radar-topo.o\
	alloc-source.o\
	find-config.o\
	read-gtopo-data.o\
	clean-source-buffer.o\
	write-dem-meta-xml.o\
	write-block-as-xml.o\
	nearest-to-ground.o

LIBHEADS  := nearest-to-ground.hpp check-product.hpp Radar-config.hpp Radars-config.hpp radar-topo.hpp


.SUFFIXES :
.SUFFIXES : .cpp .c .o .a

.cpp.o:
	${CC} ${CPPFLAGS} ${INCL} -fpic -c $< -o $@

.c.o:
	${CC} ${CCFLAGS} ${INCL} -fpic -c $< -o $@



all: ${THELIB}

${THELIB}: ${OBJS}
	${AR} ${ARFLAGS} $@ $?

install: all
	install -m 644 ${THELIB} ../lib
	install -m 644 ${LIBHEADS} ../include

nearest-to-ground-test: nearest-to-ground-test.cpp ${THELIB}
	${CC} ${CPPFLAGS} ${INCL} -o $@ $< ${LIBS} ${LDFLAGS}

nearest-to-ground-test-xml: nearest-to-ground-test-xml.cpp ${THELIB}
	${CC} ${CPPFLAGS} ${INCL} -o $@ $< ${LIBS} ${LDFLAGS}

clean:
	rm -f core core.* *~
	rm -f *.a
	rm -f *.o

